var express = require("express");
var router = express.Router();
const checkText = require("../utils/checkText");
const checkImg = require("../utils/checkImg");
const Result = require("../utils/result");

router.post("/checkText", async function (req, res) {
  const { content, openid, scene } = req.body;
  const isLegal = await checkText(content, openid, scene);
  res.json(Result.success({ isLegal }));
});

router.get("/checkImg", async function (req, res) {
  const { media_url, openid } = req.query;
  console.log("url", media_url);
  const isLegal = await checkImg(media_url, openid);
  res.json(Result.success({ isLegal }));
});

module.exports = router;
